import { _decorator, Component, Label, Node } from 'cc';
import { UIBase } from './UIBase';
import { GameData } from './GameData';
const { ccclass, property } = _decorator;

@ccclass('Setting')
export class Setting extends UIBase {
    oninit(...rest: any[]): void {
        let num=GameData.coin.toString();
        this.getComp<Label>("_Coin2","Label").string=num;
        //console.log("Setting");
        this.addClickEventL("_CloseBtn2",()=>{
            this.closeUI("Setting",true);
        })
        this.addClickEventL("_Add",()=>{
            GameData.coin+=1;
            GameData.progress+=0.1;
        })
        // this.bindCb(GameData,"coin",(oldValue,newValue)=>{
        //     this.getComp<Label>("_Coin2","Label").string=newValue;
            
        // })
        this.bindComp(GameData,"coin",this.getComp<Label>("_Coin2","Label"));
    }
}


